package com.ideaaedi.zoo.example.springboot.seata.alpha.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.ideaaedi.zoo.example.springboot.seata.alpha.service.SysUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping
@Tag(name ="测试")
public class TestController {
    
    @Resource
    private SysUserService sysUserService;
    
    @GetMapping("/test")
    @Operation(summary = "【注解方式】先feign调用beta微服务添加角色成功，然后本地添加用户失败")
    @ApiOperationSupport(order = 1)
    public void test() {
        sysUserService.test();
    }
    
    @GetMapping("/testNested")
    @Operation(summary = "【注解方式】测试GlobalTransactional注解嵌套")
    @ApiOperationSupport(order = 2)
    public void testNested() {
        sysUserService.testNested();
    }
    
    @GetMapping("/testManual")
    @Operation(summary = "【手动方式】先feign调用beta微服务添加角色成功，然后本地添加用户失败")
    @ApiOperationSupport(order = 3)
    public void testManual() {
        sysUserService.testManual();
    }
    
    @GetMapping("/testNestedManual")
    @Operation(summary = "【手动方式】测试GlobalTransactional注解嵌套")
    @ApiOperationSupport(order = 4)
    public void testNestedManual() {
        sysUserService.testNestedManual();
    }
}
